import React from 'react'
import { connect } from 'react-redux'
import { toggleSiderBar } from '@/store/actions'
import Icon from '@/components/Icon'
import './index.scss'

const Hamburger = (props) => {
  const { sidebarCollapsed, toggleSiderBar } = props

  return (
    <div className="app-hamburger" onClick={toggleSiderBar}>
      { sidebarCollapsed ? (<Icon type="MenuUnfoldOutlined" />) : (<Icon type="MenuFoldOutlined" />) }
    </div>
  )
}

export default connect(state => state.app, { toggleSiderBar })(Hamburger)
